package com.etcn.modules.busi.member.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.etcn.common.annotation.Manage;
import com.etcn.common.controller.BaseController;
import com.etcn.modules.busi.member.pojo.WmMemberAttention;
import com.etcn.modules.busi.member.service.IWmMemberAttentionService;

/**
 * 会员关注controller
 * @author guozc
 * @date: 2018-03-22 09:08:10
 */
@Controller
@RequestMapping("/v1/memberattentions")
public class WmMemberAttentionController extends BaseController {

	@Autowired
    private IWmMemberAttentionService wmMemberAttentionService;

    /**
     * 添加关注
     */
    @Manage
    @RequestMapping(value = "add", method = RequestMethod.POST)
    public @ResponseBody void add(@RequestBody Map<String,Object> param) throws Exception{
    	wmMemberAttentionService.add(param);
    }
    
    /**
     * 获取关注
     */
    @Manage
    @RequestMapping(value = "", method = RequestMethod.GET)
    public @ResponseBody Object getByMember(WmMemberAttention entity) throws Exception{
    	return wmMemberAttentionService.findByMemberId(entity);
    }
    
    /**
     * 取消关注
     */
    @Manage
    @RequestMapping(value = "cancel", method = RequestMethod.POST)
    public @ResponseBody void cancel(@RequestBody List<Map<String,String>> attentions) throws Exception{
    	wmMemberAttentionService.cancelAttentions(attentions);
    }
    
}